package com.devin.service.Impl;


import com.devin.dao.MultiMapper;
import com.devin.dao.PermissionMapper;
import com.devin.pojo.Permission;
import com.devin.service.PermissionService;
import com.github.pagehelper.PageHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
@Service("permissionService")
@Transactional
public class PermissionServiceImpl implements PermissionService {
    @Autowired
    private PermissionMapper permissionMapper;
    @Autowired
    private MultiMapper multiMapper;

    @Override
    public List<Permission> getPermissions(Integer page, Integer size) {
        PageHelper.startPage(page,size);
        return permissionMapper.getPermissions();
    }

    @Override
    public void addPermission(Permission permission) {
        permissionMapper.addPermission(permission);
    }

    @Override
    public void delPermission(Integer permissionId) {
        permissionMapper.delPermission(permissionId);
    }

    @Override
    public void delPermissionsChecked(Integer[] ids) {
        multiMapper.delPermissionsChecked(ids);
    }

}
